package com.my.easypoi.handler.data;

import cn.afterturn.easypoi.handler.impl.ExcelDataHandlerDefaultImpl;
import org.apache.commons.lang3.ArrayUtils;
/*自定义导出数据格式处理*/
public class MyImportHandler extends ExcelDataHandlerDefaultImpl {

    @Override
    public Object importHandler(Object obj, String name, Object value) {
        if(ArrayUtils.contains(this.getNeedHandlerFields(),name)){
//            Double d = Double.valueOf(value.toString());
//            return d.intValue();
            if(value==null || "".equals(value) || "null".equals(value)){
                return 0;
            }else {
                Double d = Double.valueOf(value.toString());
                return d.intValue();
            }
        }else{
            return super.importHandler(obj, name, value);
        }

    }
}
